import React, { Component, PropTypes } from 'react'
import { hashHistory } from 'react-router'

const footerTabArr = [
  {
    text: '微盘',
    link: '/blue-ui/micro-disc',
  },
  {
    text: '中盘',
    link: '/blue-ui/central-disc',
  },
  {
    text: '账户',
    link: '/blue-ui/account',
  },
  {
    text: '财经',
    link: '/blue-ui/finance',
  },
  {
    text: '排行',
    link: '/blue-ui/ranking-list',
  },
]

export default class FooterTab extends Component {
  constructor(props) {
    super(props)
    this.renderFooterTab = this.renderFooterTab.bind(this)
  }
  render() {
    return (
      <div className={`cm-footer-box`}>
        {footerTabArr.map(this.renderFooterTab)}
      </div>
    )
  }
  renderFooterTab(item, index) {
    const { defaultActiveIndex } = this.props
    return (
      <div
        key={index}
        className={`${defaultActiveIndex === index ? 'cm-active-tab' : ''}`}
        onClick={() => {
          hashHistory.push(item.link)
        }}
      >
        <i className={`iconfont icon-question`} />
        <span>{item.text}</span>
      </div>
    )
  }
}

FooterTab.propsTypes = {
  defaultActiveIndex: PropTypes.number.isRequired,
}